<?php include_once('header.php');?>
	<div class="main-content">
		<div class="breadcrumbs" id="breadcrumbs">
			<script type="text/javascript">
				try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
			</script>
			<ul class="breadcrumb">
				<li><a href="/admin/welcome"><i class="icon-home home-icon"></i>首页</a></li>
				<li><a href="/admin/article/article_list">资讯管理</a></li>
				<li><a href="/admin/article/article_list">资讯列表</a></li>
				<li>增加信息</li>
			</ul>
		</div>
		<div class="page-content" style="margin-top:18px;">										
			<div class="alert alert-block alert-success">
				<button type="button" class="close" data-dismiss="alert">
					<i class="icon-remove"></i>
				</button>
				<i class="icon-comment-alt"></i> 说明：封面图片选项可以不进行操作，编辑内容可以点击编辑框右上角图标进行全屏编辑。
			</div>		
			<div class="row">
				<div class="col-xs-12">
					<div style="border:1px solid #e1e1e1;">
						<div style="height:50px;"><span style="background-color:#f9f9f9;width:100px; height:40px; display:inline-block;*display:inline;*zoom; border:1px solid #e2e2e5; line-height:40px;color:#666; text-align:center;"><b>基本信息</b></span></div>				
						<form class="form-horizontal" enctype="multipart/form-data" role="form" method="post" action="/admin/article/add"  onsubmit="return check()">					
							<div class="form-group">
								<label for="title" class="col-sm-1 control-label">所属类别</label>
								<div class="col-sm-1">
									<select class="form-control" id="t_id" name="t_id">
										<?php
											$list = ''; 
											foreach($type_list as $k => $v) {
												$list .= '<option value="'.$v['id'].'">'.$v['name'].'</option>';											
											}
											echo $list;
										?>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label for="title" class="col-sm-1 control-label">内容标题</label>
								<div class="col-sm-2">
									<input type="text" class="form-control" id="title" name="title" value="">
								</div>
							</div>		
							<div class="form-group">
								<label for="title" class="col-sm-1 control-label">文章作者</label>
								<div class="col-sm-2">
									<input type="text" class="form-control" id="author" name="author" value="admin">
								</div>
							</div>		
							<div class="form-group">
								<label for="title" class="col-sm-1 control-label">阅读数量</label>
								<div class="col-sm-2">
									<input type="text" class="form-control" id="click" name="click" value="0">
								</div>
							</div>				
							<div class="form-group">
								<label for="title" class="col-sm-1 control-label">发布时间</label>
								<div class="col-sm-2">
									 <input type="text" class="Wdate form-control" name="publish_time" value="<?=$now_time?>" id="d412" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
								</div>
							</div>						
							<div class="form-group">
				                <label  class="col-sm-1 control-label">封面图片</label>
				                <div class="col-sm-3">
				                	<input type="hidden" class="form-control" name="litpic" value="">
				                    <input id="file-0b" class="file" type="file" name="jietu">                    
				                </div>
				             </div>				             
							<div class="form-group">
								<label for="content" class="col-sm-1 control-label">内容描述</label>
								<div class="col-sm-11">
									<textarea id="editor" name="content" type="text/plain" style="height:360px;"></textarea>
								</div>
							</div>
						 	<div class="form-group">
						   		<div class="col-sm-offset-1 col-sm-10">
									<button type="submit" id="submit" class="btn btn-primary">提交保存</button>
									<button type="submit" id="cancel" class="btn btn-warning">返回上页</button>
								</div>
						  	</div>
						</form>	
					</div>
				</div>
			</div>					
		</div>													
	</div>
<?php include_once('content.php');?>
	<link href="/public_source/www/assets/css/ace.min.css" rel="stylesheet" />	
	<link href="/public_source/www/assets/css/jquery.tag-editor.css" rel="stylesheet"/>
	<link href="/public_source/www/assets/css/fileinput.css" rel="stylesheet" type="text/css" />
	<link  rel="stylesheet" href="/public_source/www/assets/css/jquery-confirm.css" />
	<link  rel="stylesheet" href="/public_source/www/css/confirm.css" />
	<script src="/public_source/www/assets/ueditor/ueditor.config.js" type="text/javascript"></script>
    <script src="/public_source/www/assets/ueditor/ueditor.all.js" type="text/javascript"></script>
    <script src="/public_source/www/assets/js/bootbox.min.js"></script>
    <script src="/public_source/www/assets/js/fileinput.js" type="text/javascript"></script>
    <script src="/public_source/www/My97DatePicker/WdatePicker.js"></script>  
	<script src="/public_source/www/assets/js/jquery.tag-editor.min.js"></script>
	<script src="/public_source/www/assets/js/jquery-confirm.js"></script>
	<script src="/public_source/www/js/areas.js"></script>
<?php include_once('footer.php');?>	
<script type="text/javascript">
	var editor = new baidu.editor.ui.Editor();
	editor.render('editor');  //editor为编辑器容器的id
	$(document).ready(function(){
		$("#cancel").click(function() {
			window.location.replace('/admin/article/article_list');
			return false;
		});
	});
	function check() {
	   	var title = document.getElementById("title").value;
	   	var click = document.getElementById("click").value;
	   	if(title ==  null ||title == '') {
			$.alert({
			    title: '提示',
			    content:'内容标题不能为空',
			    confirm: function(){
			    }
			});
	    	return false;
	   	}
	   	if(!isPositiveNum(click) && click != 0) {
			$.alert({
			    title: '提示',
			    content:'阅读数量格式有误',
			    confirm: function(){
			    }
			});
			return false;			
		}
	   	return true;
	} 
	function isPositiveNum(s){//是否为正整数 
		var re = /^[0-9]*[1-9][0-9]*$/ ; 
		return re.test(s);
	} 			
</script>		